/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package studio.raptor.ddal.config.fetcher;

import java.util.Map;
import studio.raptor.ddal.common.exception.GenericException;

/**
 * 配置获取接口
 *
 * @author Charley
 * @since 1.0
 */
public abstract class ConfigFetcher {

  private String shardConfigPath;
  private String ruleConfigPath;
  private String serverConfigPath;
  private String routingDsPath;
  private String systemPropPath;

  /**
   * 配置获取模式
   * @return
   */
  public abstract String fetchingMode();

  /**
   * 获取文件字符串
   */
  public abstract String getFileString(String filePath) throws GenericException;

  /**
   * 获取属性Map
   *
   * 由于远程获取的properties会被包装成Config类，
   * 为方便属性使用，统一用Map承载，供上层使用；
   */
  public abstract Map<String, String> getProperties(String filePath) throws Exception;

  public String getShardConfigPath() {
    return shardConfigPath;
  }

  public void setShardConfigPath(String shardConfigPath) {
    this.shardConfigPath = shardConfigPath;
  }

  public String getServerConfigPath() {
    return serverConfigPath;
  }

  public void setServerConfigPath(String serverConfigPath) {
    this.serverConfigPath = serverConfigPath;
  }

  public String getRuleConfigPath() {
    return ruleConfigPath;
  }

  public void setRuleConfigPath(String ruleConfigPath) {
    this.ruleConfigPath = ruleConfigPath;
  }

  public String getSystemPropPath() {
    return systemPropPath;
  }

  public void setSystemPropPath(String systemPropPath) {
    this.systemPropPath = systemPropPath;
  }

  public String getRoutingDsPath() {
    return routingDsPath;
  }

  public void setRoutingDsPath(String routingDsPath) {
    this.routingDsPath = routingDsPath;
  }
}
